﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ctrlItemFornecedor.ascx.cs" Inherits="EstoqueUnifeiADO.Controles.ctrlItemFornecedor" %>
<asp:UpdatePanel ID="upItem" runat="server">
    <ContentTemplate>
        <asp:HiddenField ID="hfKey" runat="server" />
        <asp:ObjectDataSource ID="odsItem" runat="server" InsertMethod="Insert"
            OldValuesParameterFormatString="original_{0}" 
            OnInserted="odsItem_Inserted" OnSelecting="odsItem_Selecting"
            SelectMethod="GetDataByID" TypeName="EstoqueUnifeiADO.Dados.dsFornecedoresTableAdapters.FORNECEDORTableAdapter"
            UpdateMethod="Update">
            <InsertParameters>
                <asp:Parameter Name="RAZAOSOCIAL" Type="String" />
                <asp:Parameter Name="NOMEFANTASIA" Type="String" />
                <asp:Parameter Name="CNPJ" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="hfKey" Name="CODFORNECEDOR" 
                    PropertyName="Value" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="RAZAOSOCIAL" Type="String" />
                <asp:Parameter Name="NOMEFANTASIA" Type="String" />
                <asp:Parameter Name="CNPJ" Type="String" />
                <asp:Parameter Name="Original_CODFORNECEDOR" Type="Int32" />
            </UpdateParameters>
        </asp:ObjectDataSource>
        <asp:Panel ID="pnlMensagem" runat="server" BackColor="#FFFFCC" BorderColor="#FFFFCC"
            BorderStyle="Solid" BorderWidth="1px" Visible="false" Width="98%">
            <asp:Label ID="lbMensagem" runat="server" Font-Italic="True" Text="LbMensagem"></asp:Label>
        </asp:Panel>
        <asp:ValidationSummary ID="vsPage" runat="server" BackColor="White" BorderColor="Red"
            BorderWidth="2px" ForeColor="Red" Width="98%" />
        <asp:FormView ID="fvItem" runat="server" BorderColor="Black" BorderStyle="Solid"
            BorderWidth="1px" DataKeyNames="CODFORNECEDOR" DataSourceID="odsItem" OnDataBound="FormView1_DataBound"
            OnItemDeleted="ItemDeleted" OnItemInserted="fvItem_ItemInserted" OnItemUpdated="fvItem_ItemUpdated"
            Width="98%">
            <EditItemTemplate>
                Código:
                <asp:Label ID="CODFORNECEDORLabel1" runat="server" 
                    Text='<%# Eval("CODFORNECEDOR") %>'></asp:Label>
                <br />
                Razão social::
                <asp:TextBox ID="RAZAOSOCIALTextBox" runat="server" 
                    Text='<%# Bind("RAZAOSOCIAL") %>'></asp:TextBox>
                <br />
                Nome fantasia:
                <asp:TextBox ID="NOMEFANTASIATextBox" runat="server" 
                    Text='<%# Bind("NOMEFANTASIA") %>'></asp:TextBox>
                <br />
                CNPJ:
                <asp:TextBox ID="CNPJTextBox" runat="server" Text='<%# Bind("CNPJ") %>' />
                <br />
                <br />

                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="Update"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
            </EditItemTemplate>
            <InsertItemTemplate>
                Razão social:
                <asp:TextBox ID="RAZAOSOCIALTextBox" runat="server" 
                    Text='<%# Bind("RAZAOSOCIAL") %>'></asp:TextBox>
                <br />
                Nome fantasia:
                <asp:TextBox ID="NOMEFANTASIATextBox" runat="server" 
                    Text='<%# Bind("NOMEFANTASIA") %>'></asp:TextBox>
                <br />
                CNPJ:
                <asp:TextBox ID="CNPJTextBox" runat="server" Text='<%# Bind("CNPJ") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="Insert"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
            </InsertItemTemplate>
            <ItemTemplate>
                Cód. fornecedor:<br />
                <asp:TextBox ReadOnly="true" ID="CODFORNECEDORLabel" runat="server" 
                    Text='<%# Eval("CODFORNECEDOR") %>'/>
                <br />
                Razão social:<br />
                <asp:TextBox ReadOnly="true" ID="RAZAOSOCIALLabel" runat="server" 
                    Text='<%# Bind("RAZAOSOCIAL") %>' />
                <br />
                Nome fantasia:<br />
                <asp:TextBox ReadOnly="true" ID="NOMEFANTASIALabel" runat="server" 
                    Text='<%# Bind("NOMEFANTASIA") %>' />
                <br />
                CNPJ:<br />
                <asp:TextBox ReadOnly="true" ID="CNPJLabel" runat="server" Text='<%# Bind("CNPJ") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                    Text="Edit"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                    Text="New"></asp:LinkButton>
            </ItemTemplate>
        </asp:FormView>
    </ContentTemplate>
</asp:UpdatePanel>
